package com.lfy.yunpicture.manager.websocket.model;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 图片编辑动作枚举
 */
@Getter
public enum PictureEditActionEnum {
    ZOOM_IN("放大", "ZOOM_IN"),
    ZOOM_OUT("缩小", "ZOOM_OUT"),
    ROTATE_LEFT("左旋转", "ROTATE_LEFT"),
    ROTATE_RIGHT("右旋转", "ROTATE_RIGHT");

    private final String text;
    private final String value;

    PictureEditActionEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    public static List<String> getValues() {
        return Arrays.stream(values()).map(PictureEditActionEnum::getValue).collect(Collectors.toList());
    }

    public static PictureEditActionEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }
        for (PictureEditActionEnum valueEnum : values()) {
            if (valueEnum.getValue().equals(value)) {
                return valueEnum;
            }
        }
        return null;
    }
}
